package com.caiyigo.baihua.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.stereotype.Repository;

import com.caiyigo.baihua.dto.ZhuanyeDto;
import com.caiyigo.baihua.dto.ZykmDto;
import com.caiyigo.baihua.model.Zhuanye;
import com.caiyigo.baihua.model.ZhuanyeWithBLOBs;
import com.caiyigo.baihua.model.Zykm;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;

/**
 * @author Administrator
 * 
 */
@Repository
public class ZhuanyeMapperSql implements ZhuanyeMapper {
	private SqlSessionFactory sqlSessionFactory;

	public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) {
		this.sqlSessionFactory = sqlSessionFactory;
	}

	public List getList(Zhuanye dto, PageBounds pageBounds) {

		Map<String, Object> params = new HashMap<String, Object>();

		if (!StringUtils.isEmpty(dto.getZyDh())) {
			params.put(ZhuanyeDto.FileConstant.ZYDH, dto.getZyDh());
		}
		if (null != dto.getZyMc()) {
			params.put(ZhuanyeDto.FileConstant.ZYMC, dto.getZyMc());
		}

		List<Object> list = null;
		SqlSession session = sqlSessionFactory.openSession();
		try {
			list = session.selectList(
					"com.caiyigo.baihua.dao.ZhuanyeMapper.list", params,
					pageBounds);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}

		return list;
	}

	/* (non-Javadoc)
	 * @see com.caiyigo.zoo.dao.ZhuanyeMapper#deleteByPrimaryKey(java.lang.String)
	 */
	@Override
	public int deleteByPrimaryKey(String zyDh) {
		// TODO Auto-generated method stub
		return 0;
	}

	/* (non-Javadoc)
	 * @see com.caiyigo.zoo.dao.ZhuanyeMapper#insert(com.caiyigo.zoo.model.ZhuanyeWithBLOBs)
	 */
	@Override
	public int insert(ZhuanyeWithBLOBs record) {
		// TODO Auto-generated method stub
		return 0;
	}

	/* (non-Javadoc)
	 * @see com.caiyigo.zoo.dao.ZhuanyeMapper#insertSelective(com.caiyigo.zoo.model.ZhuanyeWithBLOBs)
	 */
	@Override
	public int insertSelective(ZhuanyeWithBLOBs record) {
		// TODO Auto-generated method stub
		return 0;
	}

	/* (non-Javadoc)
	 * @see com.caiyigo.zoo.dao.ZhuanyeMapper#selectByPrimaryKey(java.lang.String)
	 */
	@Override
	public ZhuanyeWithBLOBs selectByPrimaryKey(String zyDh) {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see com.caiyigo.zoo.dao.ZhuanyeMapper#updateByPrimaryKeySelective(com.caiyigo.zoo.model.ZhuanyeWithBLOBs)
	 */
	@Override
	public int updateByPrimaryKeySelective(ZhuanyeWithBLOBs record) {
		// TODO Auto-generated method stub
		return 0;
	}

	/* (non-Javadoc)
	 * @see com.caiyigo.zoo.dao.ZhuanyeMapper#updateByPrimaryKeyWithBLOBs(com.caiyigo.zoo.model.ZhuanyeWithBLOBs)
	 */
	@Override
	public int updateByPrimaryKeyWithBLOBs(ZhuanyeWithBLOBs record) {
		// TODO Auto-generated method stub
		return 0;
	}

	/* (non-Javadoc)
	 * @see com.caiyigo.zoo.dao.ZhuanyeMapper#updateByPrimaryKey(com.caiyigo.zoo.model.Zhuanye)
	 */
	@Override
	public int updateByPrimaryKey(Zhuanye record) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public List<Zhuanye> getAll() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int batchUpdate(List<Zhuanye> record) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int insertToZykm(List<Zykm> record) {
		// TODO Auto-generated method stub
		return 0;
	}

	

}
